/**
 * @param {number[]} flips
 * @return {number}
 */
var numTimesAllBlue = function (flips) {
  let len = flips.length
  let right = 0, res = 0
  for (let i = 0; i < len; i++) {
    right = Math.max(right, flips[i])
    if (right == i + 1) res++

  }

  return res
};